# coding: utf-8
import sys

from PySide6.QtWidgets import QApplication, QVBoxLayout
from qfluentwidgets import MSFluentTitleBar, isDarkTheme

from common import isWin11
from components import SongPushButton
from view.singer_info_view import SingerInfoView

if isWin11():
    from qframelesswindow import AcrylicWindow as Window
else:
    from qframelesswindow import FramelessWindow as Window


class MicaWindow(Window):

    def __init__(self):
        super().__init__()
        self.setTitleBar(MSFluentTitleBar(self))
        if isWin11():
            self.windowEffect.setMicaEffect(self.winId(), isDarkTheme())


class MainWindow(MicaWindow):
    def __init__(self):
        super().__init__()
        self.vBoxLayout = QVBoxLayout(self)
        self.singerInfoView = SingerInfoView(self)
        self.__initWidgets()
        self.__initLayout()

    def __initWidgets(self):
        self.setMinimumSize(1200, 1000)

        desktop = QApplication.screens()[0].availableGeometry()
        w, h = desktop.width(), desktop.height()
        self.move(w // 2 - self.width() // 2, h // 2 - self.height() // 2)

    def __initLayout(self):
        self.vBoxLayout.setSpacing(6)
        self.vBoxLayout.setContentsMargins(10, 45, 0, 10)
        self.vBoxLayout.addWidget(self.singerInfoView)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    # interface = SongPushButton()
    # interface.setImage(r'F:\PythonObject\music-library\resource\icons\others\default.jpg')
    # interface.setSong('周杰伦 - 七里香')
    # interface.setSinger('周杰伦')
    interface = MainWindow()
    interface.show()
    sys.exit(app.exec())
